package com.tangsm.spring.boot.validation.domain.entity;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * 学生信息
 *
 * @author tangsm
 */
public class Student implements Serializable {
    /**
     * 学生ID（基本类型）
     */
    @NotNull(message = "学生ID不能为空")
    private Long id;

    /**
     * 地址ID集合（集合类型）
     */
    @Valid
    @NotEmpty(message = "地址集合不能为空")
    private List<String> addressIds;

    /**
     * 备注（字符串）
     */
    @NotBlank(message = "备注不能为空")
    private String comment;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public List<String> getAddressIds() {
        return addressIds;
    }

    public void setAddressIds(List<String> addressIds) {
        this.addressIds = addressIds;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", addressIds=" + addressIds +
                ", comment='" + comment + '\'' +
                '}';
    }
}
